package engine.query;

import server.starDB;
import storage.metadata.*;
import storage.record.*;
import storage.tx.Transaction;


public class TablePlan implements Plan {
	private Transaction tx;
	private TableInfo ti;
	private StatInfo si;


	public TablePlan(String tblname, Transaction tx) {
		this.tx = tx;
		ti = starDB.mdMgr().getTableInfo(tblname, tx);
		si = starDB.mdMgr().getStatInfo(tblname, ti, tx);
	}


	public Scan open() {
		return new TableScan(ti, tx);
	}

	
	public int blocksAccessed() {
		return si.blocksAccessed();
	}


	public int recordsOutput() {
		return si.recordsOutput();
	}

	public int distinctValues(String fldname) {
		return si.distinctValues(fldname);
	}

	public Schema schema() {
		return ti.schema();
	}
}
